package stack;

import stack.StackWorker.WorkerInfo;



public class Stack {

	static final int WORKERS = 10;
	CentralStack stack_;
	Elimination elimination_;

	public Stack() {
		stack_= new CentralStack();
		elimination_= new Elimination(stack_, WORKERS);
	}

	public Stack(int workersNum) {
		stack_= new CentralStack();
		elimination_= new Elimination(stack_, workersNum);
	}

	public void stackOp(WorkerInfo workerInfo) {
		if (stack_.tryPerformStackOp(workerInfo) == false) {
			elimination_.lesOp(workerInfo);
		}

	}

	public int size(){
		return stack_.size();
	}

}
